﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PRC_TB_ALERTS_TASKS_STATES_SE')
	BEGIN
		DROP  Procedure  dbo.PRC_TB_ALERTS_TASKS_STATES_SE
	END

GO

CREATE Procedure dbo.PRC_TB_ALERTS_TASKS_STATES_SE
	(
		@TAT_ID int
	)

AS

select
	TS_ID,
	TS_DESCRIPTION
from TB_ALERTS_TASKS_STATES
	inner join TB_STATES
		on TATS_STATE_ID = TS_ID
where TATS_ALERT_TASK_ID = @TAT_ID
order by TS_DESCRIPTION

GO

GRANT EXEC ON dbo.PRC_TB_ALERTS_TASKS_STATES_SE TO PUBLIC

GO

